Update to cast to int

Daniel O'Connor 11 years ago
parent
commit
d7eeec1b10
2 changed files with 2 additions and 2 deletions
  1. 1 1
      app/models/agents/mqtt_agent.rb
  2. 1 1
      spec/models/agents/mqtt_agent_spec.rb

+ 1 - 1
app/models/agents/mqtt_agent.rb

@@ -116,7 +116,7 @@ module Agents
116 116
     def check
117 117
       mqtt_client.connect do |c|
118 118
 
119
-        Timeout::timeout(options['max_read_time']) {        
119
+        Timeout::timeout((options['max_read_time'].presence || 15).to_i) {
120 120
           c.get(options['topic']) do |topic, message|
121 121
 
122 122
             # A lot of services generate JSON. Try that first

+ 1 - 1
spec/models/agents/mqtt_agent_spec.rb

@@ -16,7 +16,7 @@ describe Agents::MqttAgent do
16 16
     @valid_params = {
17 17
       'uri' => "mqtt://#{@server.address}:#{@server.port}",
18 18
       'topic' => '/#',
19
-      'max_read_time' => 1,
19
+      'max_read_time' => '1',
20 20
       'expected_update_period_in_days' => "2"
21 21
     }
22 22